import request from "@/utils/request";
import { nanoid } from "nanoid";

const userApi = {
  login(data: any) {
    // return request({
    //   method: "post",
    //   url: "/api/user/login",
    //   data,
    // });

    return Promise.resolve({
      data: {
        code: 200,
        msg: "登录成功",
        data: {
          id: nanoid(),
          username: "admin",
          tel: "18879941478",
          email: "",
          avatar:
            "https://c-ssl.dtstatic.com/uploads/blog/202207/17/20220717215111_1f8a4.thumb.1000_0.jpg",
          roles: ["admin"],
          token: "admin",
        },
      },
    });
  },

  //获取用户信息
  getUserInfo(params: any) {
    // return request({
    //   method: "get",
    //   url: "/api/user/getInfo",
    //   params,
    // });
    return Promise.resolve({
      data: {
        code: 200,
        msg: "请求成功！",
        data: {
          id: nanoid(),
          username: "admin",
          tel: "18879941478",
          email: "",
          avatar:
            "https://c-ssl.dtstatic.com/uploads/blog/202207/17/20220717215111_1f8a4.thumb.1000_0.jpg",
          roles: ["admin"],
          token: "admin",
        },
      },
    });
  },
};

export default userApi;
